package com.example.minefieldkeepercloud.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;

import com.example.minefieldkeepercloud.R;
import com.example.minefieldkeepercloud.bean.MinerHarvestBean;
import com.example.minefieldkeepercloud.bean.RestartStatisticsBean;
import com.example.minefieldkeepercloud.util.TimeUtil;
import com.king.base.adapter.ViewHolderRecyclerAdapter;
import com.king.base.adapter.holder.ViewHolder;

import java.text.ParseException;
import java.util.List;

/**
 * 重启统计
 * @Author:Created by  ygy
 * @time:2019/12/4
 */
public class RestartStatisticsAdapter extends ViewHolderRecyclerAdapter<RestartStatisticsBean.DataBean> {
    public RestartStatisticsAdapter(Context context, List<RestartStatisticsBean.DataBean> listData) {
        super(context, listData);
    }

    @Override
    public View buildConvertView(LayoutInflater layoutInflater, int viewType) {
        return layoutInflater.inflate(R.layout.item_restart_statistics,null);
    }

    @Override
    public void bindViewDatas(ViewHolder holder,RestartStatisticsBean.DataBean dataBean, int position) {

        holder.setText(R.id.tv_factoryname,dataBean.getFactoryName());
        holder.setText(R.id.tv_IP,dataBean.getIP());
        holder.setText(R.id.tv_BrandName,dataBean.getBrandName());
        holder.setText(R.id.tv_ModelName,dataBean.getModelName());
        holder.setText(R.id.tv_UniqueID,dataBean.getUniqueID());
        holder.setText(R.id.tv_MacAddr,dataBean.getMacAddr());
        holder.setText(R.id.tv_MaintTypeName,dataBean.getMaintTypeName());
        holder.setText(R.id.tv_Remark,"-"+dataBean.getRemark());
        try {
            holder.setText(R.id.tv_MaintTime, TimeUtil.dealDateFormatNomm(dataBean.getMaintTime()));
        } catch (ParseException e) {
            e.printStackTrace();
        }
    }
}
